package com.stylefeng.guns.modular.system.controller;

import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.CmsUserDemand;
import com.stylefeng.guns.modular.system.service.ICmsUserDemandService;

import java.util.Map;

/**
 * 控制器
 *
 * @author fengshuonan
 * @Date 2018-10-24 10:06:40
 */
@Controller
@RequestMapping("/cmsUserDemand")
public class CmsUserDemandController extends BaseController {

   

    @Autowired
    private ICmsUserDemandService cmsUserDemandService;


    /**
     * 获取列表
     */
    @RequestMapping(value = "/getUserList")
    @ResponseBody
    public Object getUserList(@RequestParam Map<String,String> params) {
        return cmsUserDemandService.getUserList(Integer.parseInt(params.get("id")));
    }

    /**
     * 新增
     */
    //@RequestMapping(value = "/add")
    @ResponseBody
    public Object add(CmsUserDemand cmsUserDemand) {
        cmsUserDemandService.insert(cmsUserDemand);
        return SUCCESS_TIP;
    }

    /**
     * 删除
     */
    //@RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer cmsUserDemandId) {
        cmsUserDemandService.deleteById(cmsUserDemandId);
        return SUCCESS_TIP;
    }

    /**
     * 修改
     */
    //@RequestMapping(value = "/update")
    @ResponseBody
    public Object update(CmsUserDemand cmsUserDemand) {
        cmsUserDemandService.updateById(cmsUserDemand);
        return SUCCESS_TIP;
    }

    /**
     * 详情
     */
    //@RequestMapping(value = "/detail/{cmsUserDemandId}")
    @ResponseBody
    public Object detail(@PathVariable("cmsUserDemandId") Integer cmsUserDemandId) {
        return cmsUserDemandService.selectById(cmsUserDemandId);
    }
}
